home *** CD-ROM | disk | FTP | other *** search
- Path: news.cuny.edu!news
- From: Christopher Vickery <vickery@babbage.cs.qc.edu>
- Newsgroups: comp.lang.c++
- Subject: iostream error recovery question
- Date: Tue, 05 Mar 1996 16:10:13 -0500
- Organization: Queens College of CUNY
- Message-ID: <313CADB5.39AF@babbage.cs.qc.edu>
- NNTP-Posting-Host: cv_home.cs.qc.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- If x is an int, I execute "cin >> x;", and the user types a letter
- instead of a number, ios::failbit gets set, and trying to do another
- stream extraction fails. Executing cin.clear() resets the
- ios::failbit and sets ios::goodbit, and I would expect to be able
- to use cin again. However using both g++ on Unix and Borland C++
- I am unable to read anything from cin once the user types in a letter.
- What does one do to recover?
- --
- Dr. Christopher Vickery, Computer Science Department,
- Queens College of CUNY
- Do you know about the League for Programming Freedom?
- Contact http://www.lpf.org or lpf@uunet.uu.net for more information.
-